import uiautomation
class Binlibianjiqi():
        his = uiautomation.WindowControl(searchDepth=1, Name='科玛奇医院信息管理系统')  # 锁定窗口
        his.SetFocus()
        xinzheng = his.CustomControl(AutomationId='recordView',ClassName='RecordEditView').ButtonControl(AutomationId='add_btn',ClassName='Button',Name='新增')
        shuxin = his.CustomControl(AutomationId='recordView',ClassName='RecordEditView').ButtonControl(ClassName='Button',Name='刷新')
        #添加病历弹窗
        tianjiabingli = his.WindowControl(ClassName='Window',Name='添加病历')
        yiyuanmuban = tianjiabingli.TabControl(ClassName='TabControl',AutomationId='tabControl').TabItemControl(ClassName='TabItem',Name='医院模板')
        keshimuban = tianjiabingli.TabControl(ClassName='TabControl',AutomationId='tabControl').TabItemControl(ClassName='TabItem',Name='科室模板')
        gerenmuban = tianjiabingli.TabControl(ClassName='TabControl',AutomationId='tabControl').TabItemControl(ClassName='TabItem',Name='个人 模板')
        gonggongmuban = tianjiabingli.TabControl(ClassName='TabControl',AutomationId='tabControl').TabItemControl(ClassName='TabItem',Name='公共模板')
        bianjikuang = his.EditControl(AutomationId='txtFindKeyStr',ClassName='TextBox')
        chazhao = his.ButtonControl(AutomationId='search_btn',ClassName='Button',Name='查找')
        queding = his.ButtonControl(ClassName='Button',Name='确 定')
        quxiao = his.ButtonControl(ClassName='Button',Name='取 消')

        #模板数据网格
        shujuwangge = his.GroupControl(ClassName='GroupBox',Name='模板列表').DataGridControl(AutomationId='datagrid',ClassName='DataGrid')
        shuju1 =  shujuwangge.DataItemControl(ClassName='DataGridRow',foundIndex=1)

        qianming = his.TabControl(AutomationId='mainContainer',ClassName='TabControl').TabItemControl(ClassName='TabItem').ButtonControl(AutomationId='sign_btn',ClassName='Button',Name='签名')
        quxiaoqianming = his.TabControl(AutomationId='mainContainer',ClassName='TabControl').TabItemControl(ClassName='TabItem').ButtonControl(ClassName='Button',Name='取消签名')
        qianming_quxiaoqianmingtishikuang = his.WindowControl(ClassName='Window')
        qianmingmima= qianming_quxiaoqianmingtishikuang.EditControl(AutomationId='pwd',ClassName='PasswordBox')
        qianmingqueding = qianming_quxiaoqianmingtishikuang.ButtonControl(AutomationId='confirm_btn',ClassName='Button',Name='确 定')
        qianmingquxiao  = qianming_quxiaoqianmingtishikuang.ButtonControl(ClassName='Button',Name='取 消')
        xitongtishi = his.WindowControl(ClassName='Window',Name='系统提示')
        xitongtishiqueding = xitongtishi.ButtonControl(AutomationId='OkBtn',ClassName='Button',Name='确定')

        #病历签名
        def qianming_(self,qmmm):
                self.click_qm_btn()  # 点击签名
                self.input_qmmm(qmmm)  # 输入签名密码
                self.click_qmqd_btn()  # 点击签名确定按钮
                self.click_xtqd_btn()  # 点击提示确定按钮
        #取消签名
        def quxiaoqianming_(self,qmmm):
                self.click_qxqm_btn()  # 点击取消签名密码
                self.qianming_quxiaoqianmingtishikuang.Refind()
                self.qianmingmima.Refind()
                self.input_qmmm(qmmm)  # 输入签名密码
                self.qianmingqueding.Refind()
                self.click_qmqd_btn()  # 点击签名确定按钮
                self.xitongtishi.Refind()
                self.xitongtishiqueding.Refind()
                self.click_xtqd_btn()  # 点击提示确定按钮
        #点击签名
        def click_qm_btn(self):
                self.qianming.Click()

        #输入签名密码
        def input_qmmm(self,qmmm):
                self.qianmingmima.SendKeys(qmmm)
        #点击签名确定按钮
        def click_qmqd_btn(self):
                self.qianmingqueding.Click()
        #点击系统提示确定按钮
        def click_xtqd_btn(self):
                self.xitongtishiqueding.Click()
        #点击签名取消按钮
        def click_qmqx_btn(self):
                self.qianmingquxiao.Click()
        #点击取消签名
        def click_qxqm_btn(self):
                self.quxiaoqianming.Click()
        #输入密码
        def input_pwd(self,pwd):
                self.quxiaoqianming.SendKeys(pwd)
        #点击第一条数据
        def click_shuju1(self):
                self.shuju1.Click()
        #点击确定按钮
        def click_cz_btn(self):
                self.chazhao.Click()
        #点击确定按钮
        def click_qd_btn(self):
                self.queding.Click()
        #点击取消按钮
        def click_qx_btn(self):
                self.quxiao.Click()
        #输入模板名称
        def input_mbmc(self,mbmc):
                self.bianjikuang.SendKeys(mbmc)
        #点击医院模板
        def click_yymb(self):
                self.yiyuanmuban.Click()
        #点击科室模板
        def click_ksmb(self):
                self.keshimuban.Click()
        #点击个人模板
        def click_grmb(self):
                self.gerenmuban.Click()
        #点击公共模板
        def click_ggmb(self):
                self.gonggongmuban.Click()

        #点击新增
        def click_xz_btn(self):
                self.xinzheng.Click()
        #点击刷新
        def click_sx_btn(self):
                self.shuxin.Click()










